package com.api.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.api.dao.ModuleMapper;
import com.api.entity.Module;
import com.api.service.ModuleService;

@Service
public class ModuleServiceImpl implements ModuleService{

	@Autowired
	private ModuleMapper moduleMapper;

	@Override
	public int add(Module module) {
		module.preInsert();
		return this.moduleMapper.insert(module);
	}

	@Override
	public Module getModule(Module module) {
		return this.moduleMapper.get(module);
	}

	@Override
	public Module getModuleById(String id) {
		return this.moduleMapper.selectByPrimaryKey(id);
	}

	@Override
	public List<Module> getModuleByProjectId(String projectId) {
		return this.moduleMapper.getModuleByProjectId(projectId);
	}

	@Override
	public int update(Module module) {
		return this.moduleMapper.update(module);
	}
	

}
